//---------------------------------------------------------------------------


#pragma hdrstop

#include "PubDefine.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)
//---------------------------------------------------------------------------
/* From tcptraceroute, convert a numeric IP address to a string */
#define IPTOSBUFFERS    12
char * iptos(u_long in)
{
    static char output[IPTOSBUFFERS][3*4+3+1];
    static short which;
    u_char *p;

    p = (u_char *)&in;
    which = (which + 1 == IPTOSBUFFERS ? 0 : which + 1);
    sprintf(output[which], "%d.%d.%d.%d", p[3], p[2], p[1], p[0]);
    return output[which];
}
u_long iptoul(const ip_address ipaddress)
{
u_long d = ipaddress.byte1 << 24 | ipaddress.byte2 << 16 | ipaddress.byte3 << 8 | ipaddress.byte4 ;
return d;
}
void Makehashkey(const nodedata* node,char* hashkey)
{
	unsigned long ipsrc=iptoul(node->srcip)+node->sport;
	unsigned long ipdst=iptoul(node->dstip)+node->dport;
	sprintf(hashkey,"%d",ipsrc+ipdst);
	//strcpy(hashkey,FloatToStr(abs(ipsrc+ipdst)).c_str());
}
